<?php

/**
 * Contrato form base class.
 *
 * @method Contrato getObject() Returns the current form's model object
 *
 * @package    saveenergy
 * @subpackage form
 * @author     0
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseContratoForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'               => new sfWidgetFormInputHidden(),
      'referencia'       => new sfWidgetFormInputText(),
      'tipo'             => new sfWidgetFormInputText(),
      'titular'          => new sfWidgetFormInputText(),
      'cliente_id'       => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Cliente'), 'add_empty' => false)),
      'compania_id'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Compania'), 'add_empty' => false)),
      'companiaAnterior' => new sfWidgetFormInputText(),
      'comercial_id'     => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Comercial'), 'add_empty' => false)),
      'energia_id'       => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Energia'), 'add_empty' => false)),
      'tarifa_id'        => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Tarifa'), 'add_empty' => false)),
      'tarifaFirmada'    => new sfWidgetFormInputText(),
      'consumoAnual'     => new sfWidgetFormInputText(),
      'numeroCuenta'     => new sfWidgetFormInputText(),
      'estado'           => new sfWidgetFormInputText(),
      'producto'         => new sfWidgetFormInputText(),
      'ruta'             => new sfWidgetFormInputText(),
      'is_firmado'       => new sfWidgetFormInputCheckbox(),
      'is_enviado'       => new sfWidgetFormInputCheckbox(),
      'is_recibido'      => new sfWidgetFormInputCheckbox(),
      'is_tramitado'     => new sfWidgetFormInputCheckbox(),
      'fechaFirma'       => new sfWidgetFormDateTime(),
      'fechaRecibida'    => new sfWidgetFormDateTime(),
      'fechaEnvio'       => new sfWidgetFormDateTime(),
      'fechaTramitacion' => new sfWidgetFormDateTime(),
      'is_incidencia'    => new sfWidgetFormInputCheckbox(),
      'incidencia'       => new sfWidgetFormTextarea(),
      'fechaVencimiento' => new sfWidgetFormDateTime(),
      'fechaDelegado'    => new sfWidgetFormDateTime(),
      'contacto'         => new sfWidgetFormInputText(),
      'fechaRevision'    => new sfWidgetFormDateTime(),
      'created_at'       => new sfWidgetFormDateTime(),
      'updated_at'       => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'               => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'referencia'       => new sfValidatorString(array('max_length' => 50, 'required' => false)),
      'tipo'             => new sfValidatorString(array('max_length' => 50, 'required' => false)),
      'titular'          => new sfValidatorString(array('max_length' => 50)),
      'cliente_id'       => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Cliente'))),
      'compania_id'      => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Compania'))),
      'companiaAnterior' => new sfValidatorString(array('max_length' => 40, 'required' => false)),
      'comercial_id'     => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Comercial'))),
      'energia_id'       => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Energia'))),
      'tarifa_id'        => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Tarifa'))),
      'tarifaFirmada'    => new sfValidatorString(array('max_length' => 40, 'required' => false)),
      'consumoAnual'     => new sfValidatorInteger(array('required' => false)),
      'numeroCuenta'     => new sfValidatorInteger(array('required' => false)),
      'estado'           => new sfValidatorString(array('max_length' => 40, 'required' => false)),
      'producto'         => new sfValidatorString(array('max_length' => 50, 'required' => false)),
      'ruta'             => new sfValidatorString(array('max_length' => 50, 'required' => false)),
      'is_firmado'       => new sfValidatorBoolean(array('required' => false)),
      'is_enviado'       => new sfValidatorBoolean(array('required' => false)),
      'is_recibido'      => new sfValidatorBoolean(array('required' => false)),
      'is_tramitado'     => new sfValidatorBoolean(array('required' => false)),
      'fechaFirma'       => new sfValidatorDateTime(array('required' => false)),
      'fechaRecibida'    => new sfValidatorDateTime(array('required' => false)),
      'fechaEnvio'       => new sfValidatorDateTime(array('required' => false)),
      'fechaTramitacion' => new sfValidatorDateTime(array('required' => false)),
      'is_incidencia'    => new sfValidatorBoolean(array('required' => false)),
      'incidencia'       => new sfValidatorString(array('max_length' => 500, 'required' => false)),
      'fechaVencimiento' => new sfValidatorDateTime(array('required' => false)),
      'fechaDelegado'    => new sfValidatorDateTime(array('required' => false)),
      'contacto'         => new sfValidatorString(array('max_length' => 50, 'required' => false)),
      'fechaRevision'    => new sfValidatorDateTime(),
      'created_at'       => new sfValidatorDateTime(),
      'updated_at'       => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('contrato[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Contrato';
  }

}
